import request from '@/utils/request'
import { AxiosPromise } from 'axios'

const getImageUploadAddress = (): AxiosPromise<any> => {
  return request({
    method: 'GET',
    url: '/boss/course/upload/aliyunImagUploadAddressAdnAuth.json'
  })
}

interface GetVideoUploadAddressType{
    fileName: string
    imageUrl: string
}
const getVideoUploadAddress = (params: GetVideoUploadAddressType): AxiosPromise<any> => {
  return request({
    method: 'GET',
    url: '/boss/course/upload/aliyunVideoUploadAddressAdnAuth.json',
    params
  })
}

// 请求转码
const getAliyunTransCode = (data: any): AxiosPromise<any> => {
  return request({
    method: 'POST',
    url: '/boss/course/upload/aliyunTransCode.json',
    data
  })
}

// 获取转码进度
const getAliyunTransCodePercent = (lessonId: any): AxiosPromise<any> => {
  return request({
    method: 'GET',
    url: '/boss/course/upload/aliyunTransCodePercent.json',
    params: {
      lessonId
    }
  })
}

export {
  getImageUploadAddress,
  getVideoUploadAddress,
  getAliyunTransCode,
  getAliyunTransCodePercent
}
